<template>
<div :key="componentKey">
 <vol-box
    :lazy="true"
    v-model="model"
    title="整车成本数据表-导入"
    :height="400"
    :width="700"
    :padding="5"
    :onModelClose="onModelClose"
  >
    <UploadExcel
      :url="url"
      :template="template"
      :importExcelBefore="importExcelBefore"
    ></UploadExcel>
</vol-box>
</div>
</template>
<script>
    import VolBox from "@/components/basic/VolBox.vue";
    import moment from "moment/moment";
    import UploadExcel from "@/components/basic/UploadExcel.vue";
export default {
  components: {
    'vol-box': VolBox ,
    UploadExcel
  },
  data() {
    return {
      url: "api/yjy_whole_cost/import1", //导入的路径 
      template: { //下载模板的配置
        url: this.http.ipAddress+"api/yjy_whole_cost/DownLoadTemplate1?car_type="+this.$store.getters.data().car_type+"&yjy_whole_info_id="+this.$store.getters.data().yjy_whole_info_id,//下载模板的路径 
        fileName: "整车成本数据表", //模板的文件名
      },
      model: false,
    };
  },
  methods: {
    openModel() {
      this.model = true;
    },
    importExcelBefore(formData) { //点击上传时，将其他参数提交到后台
      let yjy_whole_info_id = this.$store.getters.data().yjy_whole_info_id;
      formData.append("yjy_whole_info_id", yjy_whole_info_id);
      return true;
    },
    onModelClose(){
      this.$emit('parentCall', $parent => { $parent.refresh() });
      this.yearandmonth = '';
      this.componentKey++;
    },
  },
};
</script>